<?php
/**
 * Created by PhpStorm
 * User: 龍zero
 * Date: 2022-05-14
 * Time: 16:51
 */

namespace App\Request\Banner;


use Hyperf\Validation\Request\FormRequest;

class BannerItemRequest  extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'img_id' => 'required|positive',
            'sort' => 'integer',
            'activity_id' => 'requiredIf:type,1|positive',
            'type' => 'in:0,1',
            'banner_id' => 'required|positive',
            'name' => 'string|nullable'
        ];
    }
}